<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script type="text/javascript">
    function test(person) {
      person.age = 26
      person = {
        name: 'yyy',
        age: 30
      }
      return person
    }
    const p1 = {
      name: 'yck',
      age: 25
    }
    const p2 = test(p1)
    // console.log(p1)
    // console.log(p2)

    function A() {
      let a = 1
      window.B = function () {
        console.log(a)
      }
    }
    // A()
    // B() // 1

    // for (var i = 1; i <= 5; i++) {
    //   setTimeout(function timer() {
    //     console.log(i)
    //   }, i * 1000)
    // }
    
    for (var i = 1; i <= 5; i++) {
      ;(function(j) {
        setTimeout(function timer() {
          console.log(j)
        }, j * 1000)
      })(i)
    }

  </script>
</body>
</html>